package cn.tedu.util;

import java.util.Collections;
import java.util.LinkedList;

//测试 LinkedList
public class Test1_1 {
    public static void main(String[] args) {
    //1.创建对象
        LinkedList<Integer> list =new LinkedList<>();
      //调用方法
        Collections.addAll(list,1,2,3,4,5,6,7,8);
        System.out.println(list);
        System.out.println(list.get(0));
        list.addFirst(100);
        list.addLast(200);
        System.out.println(list.getFirst());
        System.out.println(list.getLast());
        System.out.println(list.removeFirst());
        System.out.println(list.removeLast());

        System.out.println(list.offerLast(202));
        System.out.println(list.offerLast(1002));
        System.out.println(list.peekFirst());
        System.out.println(list.peekLast());
        System.out.println(list.pollFirst());
        System.out.println(list.pollLast());
    }

}
